# Maintainer: Fabian Affolter <fabian@affolter-engineering.ch>
pkgname=py3-asn1-modules
pkgver=0.4.0
pkgrel=0
pkgdesc="A collection of ASN.1-based protocols modules"
url="https://pypi.org/project/pyasn1-modules"
arch="noarch"
license="BSD-2-Clause"
depends="py3-asn1"
makedepends="py3-gpep517 py3-setuptools py3-wheel"
checkdepends="py3-pytest"
subpackages="$pkgname-pyc"
source="https://files.pythonhosted.org/packages/source/p/pyasn1-modules/pyasn1_modules-$pkgver.tar.gz"
builddir="$srcdir"/pyasn1_modules-$pkgver

replaces="py-asn1-modules" # Backwards compatibility
provides="py-asn1-modules=$pkgver-r$pkgrel" # Backwards compatibility

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest
}

package() {
	python3 -m installer -d "$pkgdir" .dist/*.whl
}

sha512sums="
d28cbb44788b3a33b9da807d273a6afab38ff420e8ce1264a9ebc68beb003f9ac9673210a5eb829d17ed1ae01798f856a0409dcbcd1a17b489c767d4b11467d3  pyasn1_modules-0.4.0.tar.gz
"
